<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>渠道缺失</title>
    <link rel="stylesheet" type="text/css" href="/webapp/css/easyui.css">
    <link rel="stylesheet" type="text/css" href="/webapp/css/icon.css">
    <link rel="stylesheet" type="text/css" href="/webapp/css/color.css">
    <link rel="stylesheet" type="text/css" href="/webapp/css/public.css">
    <script type="text/javascript" src="/webapp/js/lib/jquery.min.js"></script>
    <script type="text/javascript" src="/webapp/js/lib/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/webapp/js/lib/ajaxfileupload.js"></script>
    <script type="text/javascript" src="/webapp/js/common/config.js"></script>
</head>
<body>
     <div class="easyui-container-fluid">
         <div class="easyui-panel" style="border:none;">
             <div class="nav" id="nav"></div>
             <div class="easyui-panel" style="border:none;">
                 <form id="ff">
                     <div style="margin-bottom:20px;">
                     	<span>
                         <label class="item-label">年份：</label>
                         <input type="text" class="easyui-combobox" name="year" id="year" style="width:100px;"/>
                     	</span>
                     	<span id="monthLabel">
	                         <label class="item-label">月份：</label>
	                         <input type="text" class="easyui-combobox" name="month" id="month" style="width:100px;"/>
                     	</span>
                     	<span id="weekLabel">
	                         <label class="item-label">周数：</label>
	                         <input type="text" class="easyui-combobox" name="week" id="week" style="width:100px;"/>
                     	</span>
                         <label class="item-label">状态：</label>
                         <input id="entityStatus" class="easyui-switchbutton" checked style="width:80px;height:30px;" onText="是" offText="否"  >
                        <a href="javascript:void(0);" class="easyui-linkbutton c8" onclick="searchBy()" style="width:80px;margin-left: 40px;">查询</a>
                     </div>
                     <div style="margin-bottom:10px;margin-left: 10px;text-align:left;">
                     	<div>
                     		<span id="periodInfo" style="font-weight: bold;font-size: 16px;margin-right: 10px;"></span>
                     	</div>
                     </div>
                 </form>
             </div>
             <div class="table-wrapper">
                 <table id="datagrid" class="easyui-datagrid" data-options="scrollbarSize:0">
                     <thead>
                        <tr>
                            <th data-options="field:'code',align:'center'" width="5%">代码</th>
                         	<th data-options="field:'name',align:'center'" width="15%">名称</th>
	                        <th data-options="field:'remark',align:'center'" width="5%">备注</th>
	                        <th data-options="field:'reportWeekData',align:'center',formatter:boolFormatter" width="5%">周上报</th>
	                        <th data-options="field:'reportMonthData',align:'center',formatter:boolFormatter" width="5%">月上报</th>
	                        <th data-options="field:'onlineChannel',align:'center',formatter:boolFormatter" width="5%">线上渠道</th>
	                        <th data-options="field:'weekDataHandleUserName',align:'center'" width="5%">周报处理人</th>
	                        <th data-options="field:'monthDataHandleUserName',align:'center'" width="5%">月报处理人</th>
	                        <th data-options="field:'dataGatherer',align:'center'" width="5%">数据联系人</th>
	                        <th data-options="field:'recordReportFormat',align:'center',formatter:recordReportFormat" width="20&%">数据上报格式</th>
	                        <th data-options="field:'entityStatus',align:'center',formatter:statusFormatter" width="5%">状态</th>
	                        <th data-options="field:'updateTime',align:'center'" width="20%">添加时间</th>
                        </tr>
                     </thead>
                 </table>
             </div>
         </div>
     </div>
     <script type="text/javascript">
         $(function(){
             setNav();
             initChannelSelect("channel");
             initMonthWeek("monthLabel","weekLabel");
             $("#datagrid").datagrid({
                 // pagination:true,
                 rownumbers:true
             });
             aRecords("渠道缺失","/webapp/pages/channel/audit/channelmiss")
         });
         
         function searchBy(){
             if (!isOfflineType()) {
                 alert("该功能只支持线下模式");
                 return;
             }

        	 var periodInfo = '';
        	 periodInfo += $('#year').val()+'年';
        	 if(window.parent.workMode=='week'){
	        	 periodInfo += $('#week').val()+'周';
        	 }else{
	        	 periodInfo += $('#month').val()+'月';
        	 }
        	 periodInfo += '【未上报数据的渠道】';
        	 $('#periodInfo').html(periodInfo);
             var data = getFormData(document.getElementById("ff"));
             data.reportType=window.parent.workMode.toUpperCase();
             data.status = $("#entityStatus").switchbutton("options").checked?"true":"false";
             $.ajax({
                  url:config.url + "/channelCheck/channel/miss/list",
                  type:"get",
                  data:transfer(data),
                  xhrFields:{withCredentials:true},
                  beforeSend:function () {
                      $.messager.progress({
                          title:"请稍等",
                          interval:50,
                          text:"数据加载中..."
                      });
                    },
                  success:function(data){
                	  if(data && data.length>0){
	                	  $("#datagrid").datagrid({data: data}).datagrid("getPager");
                	  }else{
	                	  $("#datagrid").datagrid({data: []}).datagrid("getPager");
                	  }
                	  
                	  $.messager.progress("close");
                  },
                  error:function(data){
                     console.log(data);
                     $.messager.progress("close");
                  }
              });
          }
         
         var reportFormatObj = {
   	     	"SINGLE":"单条上报", 
   	     	"MULTI":"多条上报"
   	     }
   	     function recordReportFormat(val, row){
   	     	return !!reportFormatObj[val]?reportFormatObj[val]:"单条上报";
   	     }
	</script>
</body>
</html>